package userHelp

import (
	myredis "common/redis"
)

// 玩家汇总数据
type TblMemberAccu struct {
	Uid                        string  `json:"uid" db:"uid" cbor:"uid"`
	Deposit                    float64 `json:"deposit" db:"deposit" cbor:"deposit"`
	DepositTimes               int32   `json:"deposit_times" db:"deposit_times" cbor:"deposit_times"`
	Withdraw                   float64 `json:"withdraw" db:"withdraw" cbor:"withdraw"`
	WithdrawTimes              int32   `json:"withdraw_times" db:"withdraw_times" cbor:"withdraw_times"`
	Running                    float64 `json:"running" db:"running" cbor:"running"`
	GameRound                  int32   `json:"game_round" db:"game_round" cbor:"game_round"`
	GameWinlost                float64 `json:"game_winlost" db:"game_winlost" cbor:"game_winlost"`
	GameTax                    float64 `json:"game_tax" db:"game_tax" cbor:"game_tax"`
	TurntableBonus             float64 `json:"turntable_bonus" db:"turntable_bonus" cbor:"turntable_bonus"`
	TotalWaged                 float64 `json:"totalWaged" db:"totalWaged" cbor:"totalWaged"`
	ProxyInviteBonus           float64 `json:"proxy_invite_bonus" db:"proxy_invite_bonus" cbor:"proxy_invite_bonus"`
	AccuDepositBonus           float64 `json:"accu_deposit_bonus" db:"accu_deposit_bonus" cbor:"accu_deposit_bonus"`
	WeekLostReturn             float64 `json:"week_lost_return" db:"week_lost_return" cbor:"week_lost_return"`
	WeekBetReturn              float64 `json:"week_bet_return" db:"week_bet_return" cbor:"week_bet_return"`
	WeekDepositReturn          float64 `json:"week_deposit_return" db:"week_deposit_return" cbor:"week_deposit_return"`
	WeekCommiReturn            float64 `json:"week_commi_return" db:"week_commi_return" cbor:"week_commi_return"`
	DailyBetReturn             float64 `json:"daily_bet_return" db:"daily_bet_return" cbor:"daily_bet_return"`
	EnableRechargeShare        float64 `json:"enable_recharge_share" db:"enable_recharge_share" cbor:"enable_recharge_share"`
	EnableFirstDepositToParent float64 `json:"enable_first_deposit_to_parent" db:"enable_first_deposit_to_parent"`
	HiddenDepositAmount        float64 `json:"hidden_deposit_amount" db:"hidden_deposit_amount"` //充值隐藏金额
}

var g_tbl_member_accu = "tbl_member_accu:"

func AddTotalProxyInviteBonus(Uid string, AddValue float64) {
	LoadUserToRedis(Uid)
	myredis.AddUserFieldValueByFloat64(Uid, g_tbl_member_accu+"proxy_invite_bonus", AddValue)
}

func AddTotalAccuDepositBonus(Uid string, AddValue float64) {
	LoadUserToRedis(Uid)
	myredis.AddUserFieldValueByFloat64(Uid, g_tbl_member_accu+"accu_deposit_bonus", AddValue)
}

func AddTotalWeekLostReturn(Uid string, AddValue float64) {
	LoadUserToRedis(Uid)
	myredis.AddUserFieldValueByFloat64(Uid, g_tbl_member_accu+"week_lost_return", AddValue)
}

func AddTotalWeekBetReturn(Uid string, AddValue float64) {
	LoadUserToRedis(Uid)
	myredis.AddUserFieldValueByFloat64(Uid, g_tbl_member_accu+"week_bet_return", AddValue)
}

func AddTotalDailyBetReturn(Uid string, AddValue float64) {
	LoadUserToRedis(Uid)
	myredis.AddUserFieldValueByFloat64(Uid, g_tbl_member_accu+"daily_bet_return", AddValue)
}

func AddTotalWeekDepositReturn(Uid string, AddValue float64) {
	LoadUserToRedis(Uid)
	myredis.AddUserFieldValueByFloat64(Uid, g_tbl_member_accu+"week_deposit_return", AddValue)
}

func AddTotalWeekCommiReturn(Uid string, AddValue float64) {
	LoadUserToRedis(Uid)
	myredis.AddUserFieldValueByFloat64(Uid, g_tbl_member_accu+"week_commi_return", AddValue)
}

/*
获取玩家总的总值
*/
func GetTotalDeposit(Uid string) float64 {
	LoadUserToRedis(Uid)
	return myredis.GetUserFieldFloat64(Uid, g_tbl_member_accu+"deposit")
}

func AddTotalDeposit(Uid string, deposit float64) {
	LoadUserToRedis(Uid)
	myredis.AddUserFieldValueByFloat64(Uid, g_tbl_member_accu+"deposit", deposit)
}
func AddTotalHiddenDeposit(Uid string, deposit float64) {
	LoadUserToRedis(Uid)
	myredis.AddUserFieldValueByFloat64(Uid, g_tbl_member_accu+"hidden_deposit_amount", deposit)
}

func AddTotalWithdraw(Uid string, withdrawAmount float64) {
	LoadUserToRedis(Uid)
	myredis.AddUserFieldValueByFloat64(Uid, g_tbl_member_accu+"withdraw", withdrawAmount)
}

func AddTotalWithdrawTimes(Uid string, incTimes int64) {
	LoadUserToRedis(Uid)
	myredis.AddUserFieldValueByInt64(Uid, g_tbl_member_accu+"withdraw_times", incTimes)
}

func GetTotalWaged(Uid string) float64 {
	LoadUserToRedis(Uid)
	return myredis.GetUserFieldFloat64(Uid, g_tbl_member_accu+"totalWaged")
}

func AddTotalWaged(Uid string, AddWaged float64) {
	LoadUserToRedis(Uid)
	myredis.AddUserFieldValueByFloat64(Uid, g_tbl_member_accu+"totalWaged", AddWaged)
	ProcessVipUpLevel(Uid)
}

func AddDepositTime(Uid string, DepositTime int64) {
	LoadUserToRedis(Uid)
	myredis.AddUserFieldValueByInt64(Uid, g_tbl_member_accu+"deposit_times", DepositTime)
}
func AddTotalGameWinLost(Uid string, GameWinLost float64) {
	LoadUserToRedis(Uid)
	myredis.AddUserFieldValueByFloat64(Uid, g_tbl_member_accu+"game_winlost", GameWinLost)
}

func AddGameRunning(Uid string, GameRunning float64) {
	LoadUserToRedis(Uid)
	myredis.AddUserFieldValueByFloat64(Uid, g_tbl_member_accu+"running", GameRunning)
}

func AddGameRound(Uid string, incGameRound int64) {
	LoadUserToRedis(Uid)
	myredis.AddUserFieldValueByInt64(Uid, g_tbl_member_accu+"game_round", incGameRound)
}

func AddGameTax(Uid string, GameTax float64) {
	LoadUserToRedis(Uid)
	myredis.AddUserFieldValueByFloat64(Uid, g_tbl_member_accu+"game_tax", GameTax)
}

func AddTotalRechargeShare(Uid string, AddValue float64) {
	LoadUserToRedis(Uid)
	myredis.AddUserFieldValueByFloat64(Uid, g_tbl_member_accu+"enable_recharge_share", AddValue)
}

func AddTotalFirstDepositToParent(Uid string, AddValue float64) {
	LoadUserToRedis(Uid)
	myredis.AddUserFieldValueByFloat64(Uid, g_tbl_member_accu+"enable_first_deposit_to_parent", AddValue)
}

func GetDepositTime(Uid string) int32 {
	LoadUserToRedis(Uid)
	return myredis.GetUserFieldInt32(Uid, g_tbl_member_accu+"deposit_times")
}

func GetTotalWithdraw(Uid string) float64 {
	LoadUserToRedis(Uid)
	return myredis.GetUserFieldFloat64(Uid, g_tbl_member_accu+"withdraw")
}

func GetWithdrawTime(Uid string) int32 {
	LoadUserToRedis(Uid)
	return myredis.GetUserFieldInt32(Uid, g_tbl_member_accu+"withdraw_times")
}

func GetTotalGameRound(Uid string) int32 {
	LoadUserToRedis(Uid)
	return myredis.GetUserFieldInt32(Uid, g_tbl_member_accu+"game_round")
}

func GetTotalRunning(Uid string) float64 {
	LoadUserToRedis(Uid)
	return myredis.GetUserFieldFloat64(Uid, g_tbl_member_accu+"running")
}

func GetTotalGameWinLost(Uid string) float64 {
	LoadUserToRedis(Uid)
	return myredis.GetUserFieldFloat64(Uid, g_tbl_member_accu+"game_winlost")
}

func GetTotalGameTax(Uid string) float64 {
	LoadUserToRedis(Uid)
	return myredis.GetUserFieldFloat64(Uid, g_tbl_member_accu+"game_tax")
}

func GetTotalTurntableBonus(Uid string) float64 {
	LoadUserToRedis(Uid)
	return myredis.GetUserFieldFloat64(Uid, g_tbl_member_accu+"turntable_bonus")
}
